/*
 * Main.java
 *
 */


import java.awt.Component;

import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import java.util.Calendar;



public class Main {
    
    
    
    // This method is called to start the application
    public static void main (String args[]) throws InterruptedException {
       
        
        Robotrader ej = new Robotrader();
        ej.setVisible(true);//de momento si que lo veo
        ej.onConectar();//para que se conecte directamente
        
        /*
         * FORZAMOS COMPRA
         */

        
       
        /*EJECUTA ROBOT*/
        while(ej.vueltas>=0){//lo atrapamos en un bucle
        
        ej.terminado=false;
        
        
        ej.onAutomata();
        
        
        
        
        
        Thread.sleep(600000);//espera 10 minutos para volver analizar los 3
        }
    }

    static public void inform( final Component parent, final String str) {
        if( SwingUtilities.isEventDispatchThread() ) {
        	showMsg( parent, str, JOptionPane.INFORMATION_MESSAGE);
        }
        else {
            SwingUtilities.invokeLater( new Runnable() {
			public void run() {
				showMsg( parent, str, JOptionPane.INFORMATION_MESSAGE);
			}
            });
        }
    }

    static private void showMsg( Component parent, String str, int type) {    	
        // this function pops up a dlg box displaying a message
        JOptionPane.showMessageDialog( parent, str, "IB Java Test Client", type);
    }
}